home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / ActionEvent.java < prev    next >
Text File  |  1998-09-22  |  3KB  |  123 lines

  1. /*
  2.  * @(#)ActionEvent.java    1.13 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.awt.event;
  16.  
  17. import java.awt.AWTEvent;
  18. import java.awt.Event;
  19.  
  20. /**
  21.  * The action semantic event.
  22.  * @see ActionListener
  23.  *
  24.  * @version 1.13 07/01/98
  25.  * @author Carl Quinn
  26.  */
  27. public class ActionEvent extends AWTEvent {
  28.  
  29.     /**
  30.      * The shift modifier constant.
  31.      */
  32.     public static final int SHIFT_MASK        = Event.SHIFT_MASK;
  33.  
  34.     /**
  35.      * The control modifier constant.
  36.      */
  37.     public static final int CTRL_MASK        = Event.CTRL_MASK;
  38.  
  39.     /** 
  40.      * The meta modifier constant.
  41.      */
  42.     public static final int META_MASK        = Event.META_MASK;
  43.  
  44.     /** 
  45.      * The alt modifier constant.
  46.      */
  47.     public static final int ALT_MASK        = Event.ALT_MASK;
  48.  
  49.  
  50.     /**
  51.      * Marks the first integer id for the range of action event ids.
  52.      */
  53.     public static final int ACTION_FIRST        = 1001;
  54.  
  55.     /**
  56.      * Marks the last integer id for the range of action event ids.
  57.      */
  58.     public static final int ACTION_LAST                = 1001;
  59.  
  60.     /**
  61.      * An action performed event type.
  62.      */
  63.     public static final int ACTION_PERFORMED    = ACTION_FIRST; //Event.ACTION_EVENT
  64.  
  65.     String actionCommand;
  66.     int modifiers;
  67.  
  68.     /*
  69.      * JDK 1.1 serialVersionUID 
  70.      */
  71.     private static final long serialVersionUID = -7671078796273832149L;
  72.  
  73.     /**
  74.      * Constructs an ActionEvent object with the specified source object.
  75.      * @param source the object where the event originated
  76.      * @param id the type of event
  77.      * @param command the command string for this action event
  78.      */
  79.     public ActionEvent(Object source, int id, String command) {
  80.         this(source, id, command, 0);
  81.     }
  82.  
  83.     /**
  84.      * Constructs an ActionEvent object with the specified source object.
  85.      * @param source the object where the event originated
  86.      * @param id the type of event
  87.      * @param command the command string for this action event
  88.      * @param modifiers the modifiers held down during this action
  89.      */
  90.     public ActionEvent(Object source, int id, String command, int modifiers) {
  91.         super(source, id);
  92.         this.actionCommand = command;
  93.         this.modifiers = modifiers;
  94.     }
  95.  
  96.     /**
  97.      * Returns the command name associated with this action.
  98.      */
  99.     public String getActionCommand() {
  100.         return actionCommand;
  101.     }
  102.  
  103.     /**
  104.      * Returns the modifiers held down during this action event.
  105.      */
  106.     public int getModifiers() {
  107.         return modifiers;
  108.     }
  109.  
  110.     public String paramString() {
  111.         String typeStr;
  112.         switch(id) {
  113.           case ACTION_PERFORMED:
  114.               typeStr = "ACTION_PERFORMED";
  115.               break;
  116.           default:
  117.               typeStr = "unknown type";
  118.         }
  119.         return typeStr + ",cmd="+actionCommand;
  120.     }
  121.  
  122. }
  123.